package cn.com.dcsgo.controller;

import cn.com.dcsgo.domain.dto.OrderPageDTO;
import cn.com.dcsgo.domain.result.Result;
import cn.com.dcsgo.domain.vo.OrderVO;
import cn.com.dcsgo.service.OrderService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * OrderController
 *
 * @author Dcsgo
 * @since 16/5/2025 上午 10:05
 */
@CrossOrigin
@RestController
@RequestMapping("order")
@RequiredArgsConstructor
public class OrderController {
    private final OrderService orderService;

    @GetMapping("page/{page}/{size}")
    public Result<IPage<OrderVO>> page(@PathVariable Integer page,
                                       @PathVariable Integer size,
                                       OrderPageDTO orderPageDTO) {
        Page<OrderVO> pageParam = new Page<>(page, size);
        return Result.ok(orderService.getPage(pageParam, orderPageDTO));
    }
}
